
[x,y] = meshgrid(0:0.05:1, 0:0.05:1);
z = sin(2*pi*x).*sin(2*pi*y);

P = [x(:)';y(:)'];
T = z(:)';


net = newff([0 1;0 1],[10,1],{'tansig','purelin'},'trainlm');
Y = sim(net,P);
plot3(P(1,:),P(2,:),T,P(1,:),P(2,:),Y,'o')
net.trainParam.epochs = 5000;
net.trainParam.goal = 1e-5;
net = train(net,P,T);
Y = sim(net,P);
plot3(P(1,:),P(2,:),T,P(1,:),P(2,:),Y,'o')

